package com.csproj.dispatch.service.dto;


import com.csproj.dispatch.util.ContainerStatus;
import com.csproj.dispatch.util.DateJsonDeserializer;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * A DTO for the Dispatch entity.
 */

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class DispatchDTO implements Serializable {

    private String id;

    private String containerId;

    private String containerCode;

    private String logisticsId;

    private String productInfoId;

    private String routeCode;

    private String routeId;

    private String handsetCode;

    private String lockCode;

    private String platenumber;

    private String launchsiteId;

    private String timeLimit;//限时

    private String destinationsiteId;
    @JsonDeserialize(using = DateJsonDeserializer.class)
//    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8", locale = "zh")
    private ZonedDateTime launchTime;
    @JsonDeserialize(using = DateJsonDeserializer.class)
//    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8", locale = "zh")
    private ZonedDateTime expectedarriveTime;
    @JsonDeserialize(using = DateJsonDeserializer.class)
//    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8", locale = "zh")
    private ZonedDateTime arriveTime;

    private String containerStatus;

    private String containerStatusName;

    private Boolean deletedFlag;

    private String deleterUserId;
    @JsonDeserialize(using = DateJsonDeserializer.class)
//    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8", locale = "zh")
    private ZonedDateTime deletionTime;
    @JsonDeserialize(using = DateJsonDeserializer.class)
//    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8", locale = "zh")
    private ZonedDateTime lastModificationTime;

    private String lastModifierUserId;
    @JsonDeserialize(using = DateJsonDeserializer.class)
//    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8", locale = "zh")
    private ZonedDateTime creationTime;

    private String creatorUserId;


    //扩展
    private String launchsiteName;//启运站点名称
    private String destinationsiteName;//目的站点名称
    private Boolean hasWarn;//是否有报警信息

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getContainerId() {
        return containerId;
    }

    public void setContainerId(String containerId) {
        this.containerId = containerId;
    }

    public String getContainerCode() {
        return containerCode;
    }

    public void setContainerCode(String containerCode) {
        this.containerCode = containerCode;
    }

    public String getLogisticsId() {
        return logisticsId;
    }

    public void setLogisticsId(String logisticsId) {
        this.logisticsId = logisticsId;
    }

    public String getProductInfoId() {
        return productInfoId;
    }

    public void setProductInfoId(String productInfoId) {
        this.productInfoId = productInfoId;
    }

    public String getRouteCode() {
        return routeCode;
    }

    public void setRouteCode(String routeCode) {
        this.routeCode = routeCode;
    }

    public String getHandsetCode() {
        return handsetCode;
    }

    public void setHandsetCode(String handsetCode) {
        this.handsetCode = handsetCode;
    }

    public String getLockCode() {
        return lockCode;
    }

    public void setLockCode(String lockCode) {
        this.lockCode = lockCode;
    }

    public String getPlatenumber() {
        return platenumber;
    }

    public void setPlatenumber(String platenumber) {
        this.platenumber = platenumber;
    }

    public String getLaunchsiteId() {
        return launchsiteId;
    }

    public void setLaunchsiteId(String launchsiteId) {
        this.launchsiteId = launchsiteId;
    }

    public String getDestinationsiteId() {
        return destinationsiteId;
    }

    public void setDestinationsiteId(String destinationsiteId) {
        this.destinationsiteId = destinationsiteId;
    }

    public ZonedDateTime getLaunchTime() {
        return launchTime;
    }

    public void setLaunchTime(ZonedDateTime launchTime) {
        this.launchTime = launchTime;
    }

    public ZonedDateTime getExpectedarriveTime() {
        return expectedarriveTime;
    }

    public void setExpectedarriveTime(ZonedDateTime expectedarriveTime) {
        this.expectedarriveTime = expectedarriveTime;
    }

    public ZonedDateTime getArriveTime() {
        return arriveTime;
    }

    public void setArriveTime(ZonedDateTime arriveTime) {
        this.arriveTime = arriveTime;
    }

    public String getContainerStatus() {
        return containerStatus;
    }

    public void setContainerStatus(String containerStatus) {
        this.containerStatus = containerStatus;
//        this.containerStatusName = ContainerStatus.getName(Integer.valueOf(containerStatus));
    }

    public String getContainerStatusName() {
        return containerStatusName;
    }

    public void setContainerStatusName(String containerStatusName) {
        this.containerStatusName = containerStatusName;
    }

    public Boolean isDeletedFlag() {
        return deletedFlag;
    }

    public void setDeletedFlag(Boolean deletedFlag) {
        this.deletedFlag = deletedFlag;
    }

    public String getDeleterUserId() {
        return deleterUserId;
    }

    public void setDeleterUserId(String deleterUserId) {
        this.deleterUserId = deleterUserId;
    }

    public ZonedDateTime getDeletionTime() {
        return deletionTime;
    }

    public void setDeletionTime(ZonedDateTime deletionTime) {
        this.deletionTime = deletionTime;
    }

    public ZonedDateTime getLastModificationTime() {
        return lastModificationTime;
    }

    public void setLastModificationTime(ZonedDateTime lastModificationTime) {
        this.lastModificationTime = lastModificationTime;
    }

    public String getLastModifierUserId() {
        return lastModifierUserId;
    }

    public void setLastModifierUserId(String lastModifierUserId) {
        this.lastModifierUserId = lastModifierUserId;
    }

    public ZonedDateTime getCreationTime() {
        return creationTime;
    }

    public void setCreationTime(ZonedDateTime creationTime) {
        this.creationTime = creationTime;
    }

    public String getCreatorUserId() {
        return creatorUserId;
    }

    public void setCreatorUserId(String creatorUserId) {
        this.creatorUserId = creatorUserId;
    }

    public String getRouteId() {
        return routeId;
    }

    public void setRouteId(String routeId) {
        this.routeId = routeId;
    }

    public String getTimeLimit() {
        return timeLimit;
    }

    public void setTimeLimit(String timeLimit) {
        this.timeLimit = timeLimit;
    }

    public String getLaunchsiteName() {
        return launchsiteName;
    }

    public void setLaunchsiteName(String launchsiteName) {
        this.launchsiteName = launchsiteName;
    }

    public String getDestinationsiteName() {
        return destinationsiteName;
    }

    public void setDestinationsiteName(String destinationsiteName) {
        this.destinationsiteName = destinationsiteName;
    }

    public Boolean getHasWarn() {
        return hasWarn;
    }

    public void setHasWarn(Boolean hasWarn) {
        this.hasWarn = hasWarn;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        DispatchDTO dispatchDTO = (DispatchDTO) o;
        if(dispatchDTO.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), dispatchDTO.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "DispatchDTO{" +
            "id=" + getId() +
            ", containerId='" + getContainerId() + "'" +
            ", containerCode='" + getContainerCode() + "'" +
            ", logisticsId='" + getLogisticsId() + "'" +
            ", productInfoId='" + getProductInfoId() + "'" +
            ", routeCode='" + getRouteCode() + "'" +
            ", handsetCode='" + getHandsetCode() + "'" +
            ", lockCode='" + getLockCode() + "'" +
            ", platenumber='" + getPlatenumber() + "'" +
            ", launchsiteId='" + getLaunchsiteId() + "'" +
            ", destinationsiteId='" + getDestinationsiteId() + "'" +
            ", launchTime='" + getLaunchTime() + "'" +
            ", expectedarriveTime='" + getExpectedarriveTime() + "'" +
            ", arriveTime='" + getArriveTime() + "'" +
            ", containerStatus='" + getContainerStatus() + "'" +
            ", deletedFlag='" + isDeletedFlag() + "'" +
            ", deleterUserId='" + getDeleterUserId() + "'" +
            ", deletionTime='" + getDeletionTime() + "'" +
            ", lastModificationTime='" + getLastModificationTime() + "'" +
            ", lastModifierUserId='" + getLastModifierUserId() + "'" +
            ", creationTime='" + getCreationTime() + "'" +
            ", creatorUserId='" + getCreatorUserId() + "'" +
            "}";
    }
}
